<!DOCTYPE html>
<html>
<head>
  <link href="qunit/qunit.css" rel="stylesheet" type="text/css" />
  <script src="qunit/qunit.js"></script>
  <!-- Add source files here as necessary.  There are the raw source files,
  and they have not been compiled of wrapped in a closure.  Include them in the
  order that they should be included in.  If you are following the template's
  pattern, the init file MUST be loaded last. -->
  <script src="../src/ndeflibrary.const.js"></script>
  <script src="../src/ndeflibrary.core.js"></script>
  <script src="../src/ndeflibrary.module.js"></script>
  <script src="../src/submodule/ndeflibrary.NdefRecord.js"></script>
  <script src="../src/submodule/ndeflibrary.NdefAndroidAppRecord.js"></script>
  <script src="../src/submodule/ndeflibrary.NdefMessage.js"></script>
  <script src="../src/submodule/ndeflibrary.NdefUriRecord.js"></script>
  <script src="../src/submodule/ndeflibrary.NdefTelRecord.js"></script>
  <script src="../src/submodule/ndeflibrary.NdefGeoRecord.js"></script>
  <script src="../src/submodule/ndeflibrary.NdefSocialRecord.js"></script>
  <script src="../src/submodule/ndeflibrary.NdefTextRecord.js"></script>
  <script src="../src/ndeflibrary.init.js"></script>
  <script>
  </script>
</head>
<body>
  <h1 id="qunit-header">NdefTelRecord Unit Tests</h1>
   <h2 id="qunit-banner"></h2>
   <div id="qunit-testrunner-toolbar"></div>
   <h2 id="qunit-userAgent"></h2>
   <ol id="qunit-tests"></ol>
   <div id="qunit-fixture"></div>
   <script>
   (function () {

     module('NdefTelRecord Constructor');
     
     test('NdefTelRecord ', function() {
     	
     	var ndefTelRecord = new NdefLibrary.NdefTelRecord();
        
        deepEqual(ndefTelRecord.checkIfValid(), true);
        
     });
     
     test('NdefTelRecord 1', function() {
     	
     	var ndefTelRecord = new NdefLibrary.NdefTelRecord();
        deepEqual(ndefTelRecord.checkIfValid(), true);
        var telnumber = "123456123456";
        ndefTelRecord.setTelNumber(telnumber);
        
        
        deepEqual(ndefTelRecord.getTelNumber(), telnumber);
        deepEqual(ndefTelRecord.getUri(), "tel:"+telnumber);
        deepEqual(ndefTelRecord.getPayload(), [5, 49, 50, 51, 52, 53, 54, 49, 50, 51, 52, 53, 54]);
        
     });
     
     test('NdefTelRecord 2', function() {
     	
     	var ndefTelRecord = new NdefLibrary.NdefTelRecord();
        var telnumber = "123456123456";
        ndefTelRecord.setTelNumber(telnumber);
        deepEqual(ndefTelRecord.checkIfValid(), true);
        
        var ndefMessage = new NdefLibrary.NdefMessage();
        ndefMessage.push(ndefTelRecord);
        
        var bytes = ndefMessage.toByteArray();
        var ndefMessage2 = NdefLibrary.NdefMessage.fromByteArray(bytes);
        deepEqual(ndefMessage2.toByteArray(), bytes);
        deepEqual(ndefMessage2.length(), 1);
        var record = ndefMessage.getRecords()[0];
               
        deepEqual(NdefLibrary.NdefTelRecord.isRecordType(record), true);
        
        var ndefTelRecord2 = new NdefLibrary.NdefTelRecord(record);
        deepEqual(ndefTelRecord2, ndefTelRecord);
        deepEqual(ndefTelRecord2.getPayload(), ndefTelRecord.getPayload());
     });



   } ());
   </script>
</body>
</html>
